/**
 * Handle changed data.
 *
 * @param {Object} oldValue old value
 * @param {Object} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"A41C1D31-9929-40E5-BB51-6E7413D731B0"}
 */
function onDataChange_fletero(oldValue, newValue, event) {
	globals.fletero_id=proveedor_id
	return true
}

/**
 * Handle record selected.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"94398877-2989-4A30-80B8-C00BF9BEB568"}
 */
function onRecordSelection(event) {
	globals.fletero_id=proveedor_id
}

/**
 * Handle changed data.
 *
 * @param {Object} oldValue old value
 * @param {Object} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"08F1D973-08FF-455F-8855-6837BDB9C673"}
 */
function onDataChangeCuil(oldValue, newValue, event) {
	var query 	= 'select choferes_id, nombre from choferes where cuil = ?'
	var args 	= [newValue]
	var max 	= 1
	
	var $ds 	= databaseManager.getDataSetByQuery('infocom',query,args,max)
	
	if ($ds.getMaxRowIndex() != 0)
	{
		globals.DIALOGS.showErrorDialog('Error',  'CUIT Duplicado: ' + $ds.getValue(1,2),  "OK")
		return false
	}

	return true
}
